const { service } = require('../utils/request')

function getRecordByUserId(userId, date) {
  return service({
    url: `/players/${userId}/matches`,
    method: 'get'
  })
}

function getRecentRecordByUserId(userId) {
  return service({
    url: `/players/${userId}/recentMatches`,
    method: 'get'
  })
}

function getUserInfoByUserId(userId) {
  return service({
    url: `/players/${userId}`,
    method: 'get'
  })
}

function getPeerByUserId(userId) {
  return service({
    url: `/players/${userId}/peers`,
    method: 'get'
  })
}

function getHero() {
  return service({
    url: '/heroes',
    method: 'get'
  })
}

function getRanksByUserId(userId) {
  return service({
    url: `/players/${userId}/rankings`,
    method: 'get'
  })
}

function getHeroesByUserId(userId) {
  return service({
    url: `/players/${userId}/heroes`,
    method: 'get'
  })
}

function getTotalByUserId(userId, sort, limit = 10) {
  return service({
    url: `/players/${userId}/matches?sort=${sort}&limit=${limit}`,
    method: 'get'
  })
}

function getWordcloudByUserId(userId) {
  return service({
    url: `/players/${userId}/wordcloud`,
    method: 'get'
  })
}

module.exports = {
  getRecordByUserId,
  getRecentRecordByUserId,
  getUserInfoByUserId,
  getPeerByUserId,
  getHero,
  getRanksByUserId,
  getHeroesByUserId,
  getTotalByUserId,
  getWordcloudByUserId
}